export default {
    // 1.设置命名空间
    namespaced: true,
    state: {
        snumb: 100,
        students: [{
                stuname: '张三1',
                age: 30
            },
            {
                stuname: '张三2',
                age: 31
            },
        ]
    },
    getters: {
        fmtNumb(state) {
            return '****' + state.snumb + '****';
        }
    },
    mutations: {
        addStu(state, payload) {
            console.log('mutations');
            state.students.push(payload);
        }
    },
    actions: {
        asyncAddStu({
            commit
        }, payload) {
            console.log('actions');
            setTimeout(() => {
                commit('addStu', payload)
            }, 3000)
        }
    }
}